--- /home/pgimeno/temp/x/x/mmus2mid.c	2015-11-25 03:20:04.000000000 +0100
+++ ./mmus2mid.c	2015-11-24 06:06:36.000000000 +0100
@@ -782,6 +782,7 @@
 
   for (i=1;i<argc;i++)
   {
+    /*
     strcpy(musfile,argv[i]);
     p = strrchr(musfile,'.');
     q = strrchr(musfile,'\\');
@@ -789,6 +790,13 @@
     strcpy(midfile,musfile);
     strcat(musfile,".MUS");
     strcat(midfile,".MID");
+    */
+    strcpy(musfile,argv[i]);
+    strcpy(midfile,musfile);
+    p = strrchr(midfile,'.');
+    q = strrchr(midfile,'/');
+    if (p && (!q || q<p)) *p='\0';
+    strcat(midfile,".mid");
 
     musst = fopen(musfile,"rb");
     if (musst)
@@ -851,7 +859,7 @@
     else
     {
       //jff 8/3/98 use logical output routine
-      lprintf(LO_FATAL,"Can't open MUS file for input: %s\n", midfile);
+      lprintf(LO_FATAL,"Can't open MUS file for input: %s\n", musfile);
       exit(1);
     }
 
